package com.jacobson.huobi.mvp.model

import com.alibaba.fastjson.JSONObject
import com.jacobson.core.framework.repository.IRepositoryManager
import com.jacobson.core.mvp.BaseModel
import com.jacobson.huobi.api.LoginAndRegisterApi
import com.jacobson.huobi.entities.ForgetInfo
import com.jacobson.huobi.entities.LoginUserInfo
import com.jacobson.huobi.entities.RegisterInfo
import com.jacobson.huobi.entities.response.CommonResponse
import com.jacobson.huobi.entities.response.ForgetUserResponse
import com.jacobson.huobi.entities.response.LoginPageResponse
import com.jacobson.huobi.mvp.contract.ForgetContract
import com.jacobson.huobi.mvp.contract.LoginContract
import io.reactivex.Observable
import javax.inject.Inject

class ForgetModel @Inject constructor(
    repositoryManager: IRepositoryManager
) : BaseModel(repositoryManager), ForgetContract.Model {
    override fun forgetUser(forgetInfo: ForgetInfo): Observable<CommonResponse<JSONObject>> {
        return loginAndRegisterApi.forget(forgetInfo)
    }

    override fun getVertiCode(phone: String): Observable<LoginPageResponse> {
        return loginAndRegisterApi.getVertiCode(phone)
    }

    private val loginAndRegisterApi =
        repositoryManager.obtainRetrofitService(LoginAndRegisterApi::class.java)


}